package com.jeffpalm.pandoralastfm;

final class PandoraImpl implements Pandora {

  private final static PandoraImpl instance = new PandoraImpl();
  public static PandoraImpl getInstance() {
    return instance;
  }

  private PandoraImpl() {}

  private final ApplicationController app =
    new ApplicationController("PandoraBoy");

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#getCurrentArtist()
   */
  public String getCurrentArtist() {
    return exec("artist of current track");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#getCurrentTrack()
   */
  public String getCurrentTrack() {
    return exec("name of current track");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#getCurrentAlbum()
   */
  public String getCurrentAlbum() {
    return exec("album of current track");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#thumbsDown()
   */
  public String thumbsDown() {
    return exec("thumbs down");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#thumbsUp()
   */
  public String thumbsUp() {
    return exec("thumbs up");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#pausePlay()
   */
  public String pausePlay() {
    return exec("pauseplay");
  }

  /* (non-Javadoc)
   * @see com.jeffpalm.pandoralastfm.Pandora#nextTrack()
   */
  public String nextTrack() {
    return exec("next track");
  }



  public ApplicationController getApp() {
    return app;
  }

  private String exec(String cmd) {
    return app.execute(cmd);
  }
}